#include "NodeInfo.h"
#include "Globals.h"


NodeInfo::NodeInfo(std::string name)
{
	m_nodeName = name;
	mp_attributes = std::vector<std::pair<std::string, std::string> >(10);
	m_attributeCount = 0;
}


NodeInfo::~NodeInfo()
{
}

bool NodeInfo::AddAttribute(std::string key, std::string value)
{
	if (m_attributeCount < 10)
	{
		mp_attributes[m_attributeCount].first = key;
		mp_attributes[m_attributeCount].second = value;
		m_attributeCount++;
		return true;
	}
	else
	{
		return false;
	}
}

int NodeInfo::GetAttributeCount()
{
	return m_attributeCount;
}

std::string NodeInfo::GetAttributeValue(std::string key)
{
	for (int i = 0; i < m_attributeCount; ++i)
	{
		if (mp_attributes[i].first == key)
		{
			return mp_attributes[i].second;
		}
	}
	return 0;
}

std::vector<std::pair<std::string, std::string> > NodeInfo::GetAllAtributes()
{
	return mp_attributes;
}

